<?PHP

	class tpl_management {
		
		public static function management(){
		
			$title = isset($GLOBALS['OUTPUT']->search_results) ? "{$GLOBALS['LANG']->lang_admin->search_results} &nbsp;<span style='font-size: 10px;'><a href='./index.php?act=admin&page=management{$GLOBALS['OUTPUT']->ses}&query='>[{$GLOBALS['LANG']->lang_admin->clear_search}]</a></span>" :$GLOBALS['LANG']->lang_admin->userlist;
			
			$class = 'td2';
			$user_html = '';
			foreach($GLOBALS['OUTPUT']->users as $user){
				$user_html .= <<<EOV
	<tr>
		<td class='$class'>{$user['username']}</td>
		<td class='$class'>{$user['group']}</td>
		<td class='$class'><a href='./index.php?act=admin&page=edituser&uid={$user['uid']}{$GLOBALS['OUTPUT']->ses}'>[{$GLOBALS['LANG']->lang_admin->edit}]</a> <a href='./index.php?act=admin&page=edituser&uid={$user['uid']}{$GLOBALS['OUTPUT']->ses}&section=userpermissions'>[{$GLOBALS['LANG']->lang_admin->permissions}]</a> <a href='./index.php?act=admin&page=management&del={$user['uid']}{$GLOBALS['OUTPUT']->ses}'>[{$GLOBALS['LANG']->lang_admin->delete}]</a></td>
	</tr>
EOV;
				$class = $class == 'td2' ? 'td1' : 'td2';
			}
			
			$pages = '';
			for($curpage = 1; $curpage <= $GLOBALS['OUTPUT']->pages; $curpage++){
				$default = ($curpage == $GLOBALS['OUTPUT']->page) ? " selected='true'" : '';
				
				$pages .= <<<EOV
<option$default onclick="document.location='./index.php?act=admin&query={$GLOBALS['OUTPUT']->query}&page=management{$GLOBALS['OUTPUT']->ses}&pager={$curpage}'">{$curpage}</option>
EOV;
			}
			
			return	tpl_globals::header() .
				<<<EOV
<div class='table_header'>&nbsp;{$title}</div>
<table style='width: 100%;' cellspacing='1' cellpadding='5'>
	<tr>
		<td class='table_header_row' width='40%'>{$GLOBALS['LANG']->lang_admin->username}</td>
		<td class='table_header_row' width='30%'>{$GLOBALS['LANG']->lang_admin->group}</td>
		<td class='table_header_row' width='30%'>{$GLOBALS['LANG']->lang_admin->action}</td>
	</tr>
	{$user_html}
	<tr>
		<td class='table_header_row' width='100%' colspan='3'>{$GLOBALS['LANG']->lang_admin->page}: &nbsp;
			<select style='width: 60px;'>
				{$pages}
			</select>
		</td>
	</tr>
</table>

<br />

<form action='./index.php?act=admin{$GLOBALS['OUTPUT']->ses}&page=management' method='post'>
	<div class='table_header'>&nbsp;{$GLOBALS['LANG']->lang_admin->search_for_user}</div>
	<table style='width: 100%;' cellspacing='1' cellpadding='5'>
		<tr>
			<td class='td2' width='50%'>
				{$GLOBALS['LANG']->lang_admin->username}
			</td>
			<td class='td2'>
EOV
.
				tpl_form::text_password_file('text','query') .
				<<<EOV
			</td>
		</tr>
		<tr>
			<td class='table_header_row' colspan='2'><input class='form_button_norm' onmouseout="this.className=this.className.replace('_over','_norm');" onmouseover="this.className=this.className.replace('_norm','_over');" type='submit' value='{$GLOBALS['LANG']->lang_formcommon->submit}' /></td>
		</tr>
	</table>
</form>

<br />

<form action='./index.php?act=admin{$GLOBALS['OUTPUT']->ses}&page=management' method='post'>

	<div class='table_header'>&nbsp;{$GLOBALS['LANG']->lang_admin->adduser}</div>
	<table style='width: 100%;' cellspacing='1' cellpadding='5'>
		{$GLOBALS['OUTPUT']->form}
		<tr>
			<td class='table_header_row' colspan='2'><input class='form_button_norm' onmouseout="this.className=this.className.replace('_over','_norm');" onmouseover="this.className=this.className.replace('_norm','_over');" type='submit' value='{$GLOBALS['LANG']->lang_formcommon->submit}' /></td>
		</tr>
	</table>

</form>
EOV
.
			tpl_globals::footer();
				
		}
		
	}

?>